
<script>
	$.get( "http://estudiahapid.ap01.aws.af.cm/services/getrangking.php", function(data){
		var result = JSON.parse(data);
		if(result["status"] == "empty") {
		
		} else {
			for (var i = 0; i < result["length"]; i++) {
				$('#leaderboards_table').append(addRanking((i+1), result[i]["profile_username"], result[i]["profile_level"], result[i]["profile_exp"]));
			}
		}
	});
	
function addRanking(rank, username, level, point) {
	return  "<tr>" +
				"<td>" + rank + "</td>" +
				"<td>" + username + "</td>" +
				"<td>" + level + "</td>" +
				"<td>" + point + "</td>" +
			"</tr>";
};
</script>

<div id="title"><h1>Leaderboards</h1></div>

<div id="leaderboards_table_div"> 
	<table style="width:100%" id="leaderboards_table">
		<tr>
			<th>Rank</th>
			<th>Username</th>
			<th>Level</th>
			<th>Point</th>
		</tr>
		
	</table>
</div>
